package com.example.f1.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.f1.domain.Product;
import com.example.f1.service.ProductService;
import com.example.f1.mapper.ProductMapper;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import java.io.Serializable;

/**
* @author hasee
* @description 针对表【t_product】的数据库操作Service实现
* @createDate 2023-08-31 14:27:58
*/
@Service
@CacheConfig(cacheNames = "product")
public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product>
    implements ProductService{

    @Cacheable(key = "#p_id")
    @Override
    public Product getById(Serializable p_id) {
        return super.getById(p_id);
    }

    @CacheEvict(key = "#product.id")
    @Override
    public boolean updateById(Product product) {
        return super.updateById(product);
    }
}




